home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.n / scan.n < prev    next >
Text File  |  1995-07-25  |  8KB  |  199 lines

  1.  
  2.  
  3.  
  4.      ssssccccaaaannnn((((nnnn))))                      TTTTccccllll (((( ))))                      ssssccccaaaannnn((((nnnn))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           scan - Parse string using conversion specifiers in the style
  12.           of sscanf
  13.  
  14.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  15.           ssssccccaaaannnn _s_t_r_i_n_g _f_o_r_m_a_t _v_a_r_N_a_m_e ?_v_a_r_N_a_m_e ...?
  16.      _________________________________________________________________
  17.  
  18.  
  19.      IIIINNNNTTTTRRRROOOODDDDUUUUCCCCTTTTIIIIOOOONNNN
  20.           This command parses fields from an input string in the  same
  21.           fashion  as  the ANSI C ssssssssccccaaaannnnffff procedure and returns a count
  22.           of the number of fields sucessfully  parsed.   _S_t_r_i_n_g  gives
  23.           the input to be parsed and _f_o_r_m_a_t indicates how to parse it,
  24.           using %%%% conversion specifiers as in  ssssssssccccaaaannnnffff.   Each  _v_a_r_N_a_m_e
  25.           gives  the  name of a variable; when a field is scanned from
  26.           _s_t_r_i_n_g the result  is  converted  back  into  a  string  and
  27.           assigned to the corresponding variable.
  28.  
  29.  
  30.      DDDDEEEETTTTAAAAIIIILLLLSSSS OOOONNNN SSSSCCCCAAAANNNNNNNNIIIINNNNGGGG
  31.           SSSSccccaaaannnn operates by scanning _s_t_r_i_n_g and _f_o_r_m_a_t_S_t_r_i_n_g  together.
  32.           If the next character in _f_o_r_m_a_t_S_t_r_i_n_g is a blank or tab then
  33.           it is ignored.  Otherwise, if it isn't a %%%% character then it
  34.           must  match  the  next  non-white-space character of _s_t_r_i_n_g.
  35.           When a %%%% is encountered in _f_o_r_m_a_t_S_t_r_i_n_g,  it  indicates  the
  36.           start  of  a  conversion  specifier.  A conversion specifier
  37.           contains three fields after the %%%%: a ****, which indicates that
  38.           the  converted  value is to be discarded instead of assigned
  39.           to a variable; a number indicating a  maximum  field  width;
  40.           and  a  conversion  character.   All  of  these  fields  are
  41.           optional except for the conversion character.
  42.  
  43.           When ssssccccaaaannnn finds a conversion specifier in  _f_o_r_m_a_t_S_t_r_i_n_g,  it
  44.           first  skips  any white-space characters in _s_t_r_i_n_g.  Then it
  45.           converts  the  next  input  characters  according   to   the
  46.           conversion  specifier  and stores the result in the variable
  47.           given  by  the  next  argument  to  ssssccccaaaannnn.    The   following
  48.           conversion characters are supported:
  49.  
  50.           dddd         The input field must be a decimal integer.  It  is
  51.                     read in and the value is stored in the variable as
  52.                     a decimal string.
  53.  
  54.           oooo         The input field must be an octal  integer.  It  is
  55.                     read in and the value is stored in the variable as
  56.                     a decimal string.
  57.  
  58.           xxxx         The input field must be a hexadecimal integer.  It
  59.                     is read in and the value is stored in the variable
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/17/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      ssssccccaaaannnn((((nnnn))))                      TTTTccccllll (((( ))))                      ssssccccaaaannnn((((nnnn))))
  71.  
  72.  
  73.  
  74.                     as a decimal string.
  75.  
  76.           cccc         A single character is read in and its binary value
  77.                     is  stored  in  the  variable as a decimal string.
  78.                     Initial white space is not skipped in  this  case,
  79.                     so the input field may be a white-space character.
  80.                     This  conversion  is  different  from   the   ANSI
  81.                     standard  in  that the input field always consists
  82.                     of a single character and no field  width  may  be
  83.                     specified.
  84.  
  85.           ssss         The input field consists of all the characters  up
  86.                     to  the next white-space character; the characters
  87.                     are copied to the variable.
  88.  
  89.           eeee or ffff or gggg
  90.                     The input field must be  a  floating-point  number
  91.                     consisting  of  an  optional  sign,  a  string  of
  92.                     decimal digits  possibly  con  taining  a  decimal
  93.                     point, and an optional exponent consisting of an eeee
  94.                     or EEEE followed by an optional sign and a string  of
  95.                     decimal  digits.   It is read in and stored in the
  96.                     variable as a floating-point string.
  97.  
  98.           [[[[_c_h_a_r_s]]]]   The  input  field  consists  of  any   number   of
  99.                     characters  in  _c_h_a_r_s.   The  matching  string  is
  100.                     stored in the variable.  If  the  first  character
  101.                     between  the brackets is a ]]]] then it is treated as
  102.                     part of _c_h_a_r_s rather than the closing bracket  for
  103.                     the set.
  104.  
  105.           [[[[^^^^_c_h_a_r_s]]]]  The  input  field  consists  of  any   number   of
  106.                     characters  not  in _c_h_a_r_s.  The matching string is
  107.                     stored  in  the  variable.    If   the   character
  108.                     immediately  following  the  ^^^^  is  a ]]]] then it is
  109.                     treated as part of the set rather than the closing
  110.                     bracket for the set.
  111.  
  112.           The  number  of  characters  read  from  the  input  for   a
  113.           conversion  is  the largest number that makes sense for that
  114.           particular conversion  (e.g.   as  many  decimal  digits  as
  115.           possible  for  %%%%dddd,  as many octal digits as possible for %%%%oooo,
  116.           and  so  on).   The  input  field  for  a  given  conversion
  117.           terminates   either   when   a   white-space   character  is
  118.           encountered  or  when  the  maximum  field  width  has  been
  119.           reached,  whichever  comes  first.  If a **** is present in the
  120.           conversion specifier then no variable is  assigned  and  the
  121.           next scan argument is not consumed.
  122.  
  123.  
  124.      DDDDIIIIFFFFFFFFEEEERRRREEEENNNNCCCCEEEESSSS FFFFRRRROOOOMMMM AAAANNNNSSSSIIII SSSSSSSSCCCCAAAANNNNFFFF
  125.           The behavior of the ssssccccaaaannnn command is the same as the behavior
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 7/17/95)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      ssssccccaaaannnn((((nnnn))))                      TTTTccccllll (((( ))))                      ssssccccaaaannnn((((nnnn))))
  137.  
  138.  
  139.  
  140.           of  the  ANSI  C  ssssssssccccaaaannnnffff  procedure except for the following
  141.           differences:
  142.  
  143.           [1]  %%%%pppp and  %%%%nnnn  conversion  specifiers  are  not  currently  |
  144.                supported.
  145.  
  146.           [2]  For  %%%%cccc  conversions  a  single  character   value   is
  147.                converted  to  a decimal string, which is then assigned
  148.                to the corresponding _v_a_r_N_a_m_e; no  field  width  may  be
  149.                specified for this conversion.
  150.  
  151.           [3]  The llll, hhhh, and LLLL modifiers are ignored;  integer  values  |
  152.                are  always  converted  as  if  there  were no modifier  |
  153.                present and real values are always converted as if  the  |
  154.                llll  modifier  were present (i.e. type ddddoooouuuubbbblllleeee is used for  |
  155.                the internal representation).
  156.  
  157.  
  158.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  159.           conversion specifier, parse, scan
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 7/17/95)
  196.  
  197.  
  198.  
  199.